// Copyright (C) 2012 Tanmay Sinha
// All rights reserved

package org.saakshar;

import static org.saakshar.utils.FontUtils.*;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * 
 * Custom {@link TextView} for the {@link ReaderActivity}
 * 
 * @author tanmay
 * 
 */
public class ReaderTextView extends TextView {

	public ReaderTextView(Context context) {
		super(context);
	}

	public ReaderTextView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public ReaderTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	public void setTypeface(Typeface tf, int style) {
		Typeface typefaceRegular = loadFont(getContext(), getResources()
				.getString(R.string.fs_me));
		Typeface typefaceBold = loadFont(getContext(), getResources()
				.getString(R.string.fs_me_b));

		if (style == Typeface.BOLD && typefaceBold != null) {
			super.setTypeface(typefaceBold);
		} else {
			super.setTypeface(typefaceRegular);
		}
	}

}
